/**
 * File StockDAO.java created by Pablo Díaz Fernández
 * on 20/04/2012 for the project supply-chain-simulator
 */
package org.lsk.pfc.scsim.model.persistence.dao.impl;

import java.util.List;

import org.lsk.pfc.scsim.model.persistence.dao.IStockDAO;
import org.lsk.pfc.scsim.model.persistence.dto.StockDTO;

/**
 * DAO for the {@link StockDTO} objects.
 * 
 * @author Pablo Díaz Fernández
 */
public final class StockDAO extends BaseDAO implements IStockDAO {

	/**
	 * Retrieves the object specified by the id from the database.
	 * 
	 * @param dto
	 *            DTO that contains the identifier of the object to retrieve.
	 * @return {@link StockDTO} found or <code>null</code> if no one matches.
	 * @see org.lsk.pfc.scsim.model.persistence.dao.IRequestDAO#retrieve(
	 * org.lsk.pfc.scsim.model.persistence.dto.StockDTO)
	 */
	public StockDTO retrieve(final StockDTO dto) {
		return (StockDTO) super.retrieve(dto);
	}

	/**
	 * Finds all object that match with the specified template.
	 * 
	 * @param dto
	 *            {@link StockDTO} template to search.
	 * @return {@link List} of {@link StockDTO} found.
	 * @see org.lsk.pfc.scsim.model.persistence.dao.IRequestDAO#list(
	 * org.lsk.pfc.scsim.model.persistence.dto.StockDTO)
	 */
	@SuppressWarnings("unchecked")
    public List<StockDTO> list(final StockDTO dto) {
		return (List<StockDTO>) super.list(dto);
	}

	/**
	 * Creates the {@link StockDTO} in database or updates it if already
	 * exists.
	 * 
	 * @param dto
	 *            Object to persist.
	 * @return Object persisted.
	 * @see org.lsk.pfc.scsim.model.persistence.dao.IRequestDAO#createOrUpdate(
	 * org.lsk.pfc.scsim.model.persistence.dto.StockDTO)
	 */
	public StockDTO createOrUpdate(final StockDTO dto) {
		return (StockDTO) super.createOrUpdate(dto);
	}

	/**
	 * Deletes the object from the database.
	 * 
	 * @param dto
	 *            DTO that contains the identifier of the object to delete.
	 * @see org.lsk.pfc.scsim.model.persistence.dao.IRequestDAO#delete(
	 * org.lsk.pfc.scsim.model.persistence.dto.StockDTO)
	 */
	public void delete(final StockDTO dto) {
		super.delete(dto);
	}

}
